package com.wkq;


import org.greenrobot.greendao.generator.DaoGenerator;
import org.greenrobot.greendao.generator.Entity;
import org.greenrobot.greendao.generator.Schema;

public class MainDaoGenerator {

    public static void main(String args[]) throws Exception {
        Schema schema = new Schema(10, "com.wkq.database.dao");
        addDefautDao(schema);
        addUserInfo(schema);
        addCollection(schema);
        addSignInInfo(schema);
        addNewsComment(schema);

        new DaoGenerator().generateAll(schema, args[0]);
    }


    //
    private static void addDefautDao(Schema schema) {
        Entity uploadVideo = schema.addEntity("ExceptionInfo");
        uploadVideo.setHasKeepSections(true);
        uploadVideo.addIdProperty().autoincrement().primaryKey();
        uploadVideo.addStringProperty("ErrorTag").notNull();
        uploadVideo.addStringProperty("ErrorMessage").notNull();
    }

    private static void addUserInfo(Schema schema) {
        Entity uploadVideo = schema.addEntity("UserInfo");
        uploadVideo.setHasKeepSections(true);
        uploadVideo.addStringProperty("UserName").notNull();
        uploadVideo.addStringProperty("UserPhoneNum").primaryKey();
        uploadVideo.addStringProperty("UserPwd").notNull();
        uploadVideo.addStringProperty("UserIcon");
        uploadVideo.addBooleanProperty("IsLogout").notNull();
        uploadVideo.addStringProperty("UserDesc");
        uploadVideo.addStringProperty("UserSex");
        uploadVideo.addStringProperty("UserLocation");
    }

    private static void addCollection(Schema schema) {
        Entity uploadVideo = schema.addEntity("CollectionNewsInfo");
        uploadVideo.setHasKeepSections(true);
        uploadVideo.addStringProperty("id").notNull();
        uploadVideo.addLongProperty("time").notNull().primaryKey();
        ;
        uploadVideo.addStringProperty("news_id").notNull();
        uploadVideo.addStringProperty("news_type");
        uploadVideo.addStringProperty("news_time").notNull();
        uploadVideo.addStringProperty("news_title").notNull();
        uploadVideo.addStringProperty("news_icon").notNull();
        uploadVideo.addStringProperty("news_author").notNull();
        uploadVideo.addStringProperty("news_desc").notNull();
        uploadVideo.addStringProperty("type").notNull();
    }

    private static void addSignInInfo(Schema schema) {
        Entity uploadVideo = schema.addEntity("SignInInfo");
        uploadVideo.setHasKeepSections(true);
        uploadVideo.addStringProperty("id").notNull();
        uploadVideo.addLongProperty("time").notNull().primaryKey();
        uploadVideo.addStringProperty("s_years_mounth_days").notNull();
        uploadVideo.addStringProperty("s_mouth").notNull();
        uploadVideo.addStringProperty("s_years").notNull();
        uploadVideo.addStringProperty("s_days").notNull();
    }

    private static void addNewsComment(Schema schema) {
        Entity uploadVideo = schema.addEntity("NewsComment");
        uploadVideo.setHasKeepSections(true);
        uploadVideo.addLongProperty("time").notNull().primaryKey();
        uploadVideo.addStringProperty("news_comment_content").notNull();
        uploadVideo.addStringProperty("news_typs").notNull();
        uploadVideo.addStringProperty("news_id").notNull();
        uploadVideo.addStringProperty("news_comment_user_icon");
        uploadVideo.addStringProperty("news_comment_user_name");
        uploadVideo.addStringProperty("news_title");
        uploadVideo.addStringProperty("news_icon");
        uploadVideo.addStringProperty("news_desc");
    }


}
